<include file="Public/header" title="{$siteSetting['site_seo_title']}" keywords="{$siteSetting['site_seo_keywords']}" description="{$siteSetting['site_seo_description']}" />

<!-- bootstrap-star-rating
<link rel="stylesheet" href="__TMPL__Public/assets/plugins/bootstrap-star-rating/css/star-rating.min.css" />
<script src="__TMPL__Public/assets/plugins/bootstrap-star-rating/js/star-rating.min.js"></script> -->
<style>

</style>

<form action="{:U('Borrow/Index/addBorrow')}" method="post">
	<!-- MAIN -->
    <main class="x-content x-m-b-50">
		<section class="x-box with-border x-m-b-10 post regfill">			
			<div class="x-box-header post-header with-border">
				<h3>{$book.name}</h3>
			</div>
			<div class="x-box-body post-body">
				<h3>活动信息</h3>
				<ul class="x-row code-list">
					<content id="vo" table-name="code" where="tid=$tid" order="id asc">
					<li class="x-col-12-12">
						<input type="radio" class="x-check-input" id="code-item-{$vo.id}" name="code_id" value="{$vo.id}" <if condition="$vo['id'] eq $codeId">checked</if> required />
						<label for="code-item-{$vo.id}" class="x-row code-item">
							<span class="x-col-2-12 item-icon">
								<i class="ion-ios-checkmark"></i>
							</span>
							<span class="x-col-10-12 x-p-10">
								<span class="x-row">
									<span class="x-col-8-12"><h3>{$vo.name}</h3></span>
									<span class="x-col-4-12"><span class="text-orange x-pull-right" style="font-size:0.2rem;">¥{$vo.price}</span></span>
									<p class="x-col-12-12">时间：<span class="text-default">{$vo.start_datetime}</span> 至 <span class="text-default">{$vo.end_datetime}</span></p>
								</span>
							</span>
						</label>
					</li>
					</content>
				</ul>
				
				<div class="x-row">
					<div class="x-col-4-12"><h3>参与人数量</h3></div>
					<div class="x-col-8-12 x-p-10 text-right">
						<div class="x-min-add-block">
							<a href="javascript:void(0);" class="x-min-add-btn x-min disabled">-</a>
								<input type="number" class="x-number" name="code_count" />
							<a href="javascript:void(0);" class="x-min-add-btn x-add">+</a>
						</div>
					</div>
				</div>
				
				<h3>联系人信息</h3>
				<ul class="x-row">
					<li class="x-col-12-12">
						<div class="x-row">
							<label for="master_name" class="x-col-3-12 x-label-name">姓名</label>
							<input type="text" class="x-col-7-12 x-input-value" name="master_name" id="master_name" placeholder="姓名" value="{$customer.real_name}" required />
							<label for="master_name" class="x-col-2-12 x-label-name"><i class="ion-ios-compose-outline"></i></label>
						</div>
					</li>
					<li class="x-col-12-12">
						<div class="x-row">
							<label for="master_tel" class="x-col-3-12 x-label-name">手机</label>
							<input type="tel" class="x-col-7-12 x-input-value" name="master_tel" id="master_tel" placeholder="手机" value="{$customer.tel}" required />
							<label for="master_tel" class="x-col-2-12 x-label-name"><i class="ion-ios-compose-outline"></i></label>
						</div>
					</li>
				</ul>
				
				<h3>备注</h3>
				<textarea rows="3" class="x-form-control with-corner" name="remark" placeholder="备注"></textarea>
				
				<h3>支付方式</h3>
				<ul class="x-row x-square-list-ext">
					<li class="x-col-6-12">
						<input type="radio" class="x-check-input" id="payway-1" name="payway" value="1" required checked />
						<label for="payway-1" class="x-row code-item payway-item">
							<span class="x-col-4-12 item-icon">
								<i class="ion-ios-checkmark"></i>
							</span>
							<span class="x-col-8-12 x-p-10">
								微信
							</span>
						</label>
					</li>
					<li class="x-col-6-12">
						<input type="radio" class="x-check-input" id="payway-2" name="payway" value="2" required />
						<label for="payway-2" class="x-row code-item payway-item">
							<span class="x-col-4-12 item-icon">
								<i class="ion-ios-checkmark"></i>
							</span>
							<span class="x-col-8-12 x-p-10">
								会员卡
							</span>
						</label>
					</li>
				</ul>
			</div>
		</section>
    </main>
    <!-- /MAIN -->
    
	<!-- FOOTER -->
    <footer class="x-footer">
		<ul class="x-row x-footer-bar with-border-top">
			<li class="x-col-6-12">
				<button class="button button-block button-default button-large" onclick="javascript:history.go(-1);return false;">返回</button>
			</li>
			<li class="x-col-6-12">
				<button class="button button-block button-caution button-large" type="submit">确认</button>
			</li>
		</ul>
	</footer>
	<!-- /FOOTER -->
	
	<input type="hidden" name="book_id" value="{$book.id}" />
	<input type="hidden" name="book_name" value="{$book.name}" />
	<input type="hidden" name="book_url" value="{$book.url}" />
</form>

<script type="text/javascript">
(function() {
	//////x-min-add-btn
	var minNum = 1;
	var maxNum = null;
	var step = 1;
	// _setSumMoney(minNum);
	$('.x-number').val(minNum);
	$('.x-number').attr("min", minNum);
//	$('.x-number').attr("max", maxNum);
	$('.x-min-add-btn').click(function() {
		var _num = 0;
		if ($(this).hasClass('x-min')) {
			_num = parseInt($('.x-number').val()) - step;					// 取出现在的值，并使用parseInt转为int类型数据
			if (_num < minNum) {
				$(this).addClass('disabled');
				return false;
			}
			if (maxNum != null && _num < maxNum) {
				$('.x-add').removeClass('disabled');
			}
		} else {
			_num = parseInt($('.x-number').val()) + step;					// 取出现在的值，并使用parseInt转为int类型数据
			if (maxNum != null && _num > maxNum) {
				$(this).addClass('disabled');
				return false;
			}
			if (_num > minNum) {
				$('.x-min').removeClass('disabled');
			}
		}
		$('.x-number').val(_num);
		
		// functions
		// _setSumMoney(_num);
	});
})();
</script>
